//
//  SLUserAccount.swift
//  sulit-loan
//
//  Created by 王刚锋 on 2025/4/5.
//  Copyright © 2025 coolBoy. All rights reserved.
//

import UIKit
import SwiftyJSON
import KakaJSON
import DCURLRouter
class SLUserAccount: NSObject {
    @objc static var isLogin: Bool {
          let pt = !SLUserAccount.default.sessionId.isEmpty
          return pt
      }
    @objc static  let `default` = SLUserAccount()
    
    var hair: String {
        guard let prepare = __valueForKey(key: kHair) as? String else { return "" }
        return prepare
    }
    var sessionId: String {
        guard let prepare = __valueForKey(key: KSessionId) as? String else { return "" }
        return prepare
    }
    private override init() {}
}
func jump(url: String?){
    if let appDelegate = UIApplication.shared.delegate as? AppDelegate,let urlStr = url {
        appDelegate.jump(urlStr: urlStr)
    }
}
func GoToLoginVC() {
    if !SLUserAccount.isLogin{
        let login = SLNavigationController(rootViewController: SLLoginVC())
        login.modalPresentationStyle = .fullScreen
        login.modalTransitionStyle = .coverVertical
        DCURLRouter.present(login, animated: true)
    }
}
extension SLUserAccount{
    class func logout(){
        __removeForKey(key: KSessionId)
    }
}
